package com.googlethemebuilder;

import java.util.ArrayList;

/**
 * 
 * @author hong
 * Class for ConfigMap
 * 
 */
public class ConfigMap {

	// TODO: all validations
	
	private ArrayList<Trait> traits = new ArrayList<Trait>();
	private String headerBackgroundColor;
	private String headerCenterImageUrl;
	private String headerTileImageUrl;
	private String headerLogo;
	private String headerLinkColor;
	private String headerTextColor;
	private String gadgetAreaTabBorderColor;
	private String gadgetAreaTabSelectedBackgroundColor;
	private String gadgetAreaTabSelectedTextColor;
	private String gadgetAreaTabUnselectedBackgroundColor;
	private String gadgetAreaTabUnselectedTextColor;
	private String gadgetAreaBorderColor;
	private String gadgetAreaGadgetBorderColor;
	private String gadgetAreaGadgetHeaderBackgroundColor;
	private String gadgetAreaGadgetHeaderTextColor;
	private String gadgetAreaGadgetBodyLinkColor;
	private String gadgetAreaMenuIconImageUrl;
	private String gadgetAreaMenuIconHoverImageUrl;
	private String gadgetAreaDeleteIconImageUrl;
	private String gadgetAreaDeleteIconHoverImageUrl;
	private String gadgetAreaCollapseIconImageUrl;
	private String gadgetAreaCollapseIconHoverImageUrl;
	private String gadgetAreaExpandIconImageUrl;
	private String gadgetAreaExpandIconHoverImageUrl;
	private String footerBackgroundColor;
	private String footerCenterImageUrl;
	private String footerTileImageUrl;
	private String footerLinkColor;
	private String footerTextColor;
	private String attributionImageUrl;
	
	public ConfigMap() {}
	
	public void addTrait(Trait trait) {
		traits.add(trait);
	}
	
	public void setButtonIconGroup(String[] buttonIconGroup) {
		this.gadgetAreaMenuIconImageUrl = buttonIconGroup[0];
		this.gadgetAreaMenuIconHoverImageUrl = buttonIconGroup[1];
		this.gadgetAreaDeleteIconImageUrl = buttonIconGroup[2];
		this.gadgetAreaDeleteIconHoverImageUrl = buttonIconGroup[3];
		this.gadgetAreaCollapseIconImageUrl = buttonIconGroup[4];
		this.gadgetAreaCollapseIconHoverImageUrl = buttonIconGroup[5];
		this.gadgetAreaExpandIconImageUrl = buttonIconGroup[6];
		this.gadgetAreaExpandIconHoverImageUrl = buttonIconGroup[7];
	}
	
	public String toXML() {
		StringBuilder sb = new StringBuilder();
		sb.append("<ConfigMap type=\"Skin\">");
		for (Trait trait : traits) {
			sb.append(trait.toXML());
			
			if (headerBackgroundColor!=null)
				sb.append("<Attribute name=\"header.background_color\">").append(this.headerBackgroundColor).append("</Attribute>");
			if (headerTileImageUrl!=null)
				sb.append("<Attribute name=\"header.tile_image.url\">").append(this.headerTileImageUrl).append("</Attribute>");
			if (headerCenterImageUrl!=null)
				sb.append("<Attribute name=\"header.center_image.url\">").append(this.headerCenterImageUrl).append("</Attribute>");
			if (headerLinkColor!=null)
				sb.append("<Attribute name=\"header.link_color\">").append(this.headerLinkColor).append("</Attribute>");
			if (headerTextColor!=null)
				sb.append("<Attribute name=\"header.text_color\">").append(this.headerTextColor).append("</Attribute>");
			if (headerLogo!=null)
				sb.append("<Attribute name=\"header.logo\">").append(this.headerLogo).append("</Attribute>");
			if (gadgetAreaTabBorderColor!=null)
				sb.append("<Attribute name=\"gadget_area.tab.border_color\">").append(this.gadgetAreaTabBorderColor).append("</Attribute>");
			if (gadgetAreaTabSelectedBackgroundColor!=null)
				sb.append("<Attribute name=\"gadget_area.tab.selected.background_color\">").append(this.gadgetAreaTabSelectedBackgroundColor).append("</Attribute>");
			if (gadgetAreaTabSelectedTextColor!=null)
				sb.append("<Attribute name=\"gadget_area.tab.selected.text_color\">").append(this.gadgetAreaTabSelectedTextColor).append("</Attribute>");
			if (gadgetAreaTabUnselectedBackgroundColor!=null)
				sb.append("<Attribute name=\"gadget_area.tab.unselected.background_color\">").append(this.gadgetAreaTabUnselectedBackgroundColor).append("</Attribute>");
			if (gadgetAreaTabUnselectedTextColor!=null)
				sb.append("<Attribute name=\"gadget_area.tab.unselected.text_color\">").append(this.gadgetAreaTabUnselectedTextColor).append("</Attribute>");
			if (gadgetAreaBorderColor!=null)
				sb.append("<Attribute name=\"gadget_area.border_color\">").append(this.gadgetAreaBorderColor).append("</Attribute>");
			if (gadgetAreaGadgetHeaderBackgroundColor!=null)
				sb.append("<Attribute name=\"gadget_area.gadget.header.background_color\">").append(this.gadgetAreaGadgetHeaderBackgroundColor).append("</Attribute>");
			if (gadgetAreaGadgetHeaderTextColor!=null)
				sb.append("<Attribute name=\"gadget_area.gadget.header.text_color\">").append(this.gadgetAreaGadgetHeaderTextColor).append("</Attribute>");
			if (gadgetAreaGadgetBorderColor!=null)
				sb.append("<Attribute name=\"gadget_area.gadget.border_color\">").append(this.gadgetAreaGadgetBorderColor).append("</Attribute>");
			if (gadgetAreaGadgetBodyLinkColor!=null)
				sb.append("<Attribute name=\"gadget_area.gadget.body.link_color\">").append(this.gadgetAreaGadgetBodyLinkColor).append("</Attribute>");
			if (gadgetAreaMenuIconImageUrl!=null)
				sb.append("<Attribute name=\"gadget_area.menu_icon.image.url\">").append(this.gadgetAreaMenuIconImageUrl).append("</Attribute>");
			if (gadgetAreaMenuIconHoverImageUrl!=null)
				sb.append("<Attribute name=\"gadget_area.menu_icon.hover_image.url\">").append(this.gadgetAreaMenuIconHoverImageUrl).append("</Attribute>");
			if (gadgetAreaDeleteIconImageUrl!=null)
				sb.append("<Attribute name=\"gadget_area.delete_icon.image.url\">").append(this.gadgetAreaDeleteIconImageUrl).append("</Attribute>");
			if (gadgetAreaDeleteIconHoverImageUrl!=null)
				sb.append("<Attribute name=\"gadget_area.delete_icon.hover_image.url\">").append(this.gadgetAreaDeleteIconHoverImageUrl).append("</Attribute>");
			if (gadgetAreaCollapseIconImageUrl!=null)
				sb.append("<Attribute name=\"gadget_area.collapse_icon.image.url\">").append(this.gadgetAreaCollapseIconImageUrl).append("</Attribute>");
			if (gadgetAreaCollapseIconHoverImageUrl!=null)
				sb.append("<Attribute name=\"gadget_area.collapse_icon.hover_image.url\">").append(this.gadgetAreaCollapseIconHoverImageUrl).append("</Attribute>");
			if (gadgetAreaExpandIconImageUrl!=null)
				sb.append("<Attribute name=\"gadget_area.expand_icon.image.url\">").append(this.gadgetAreaExpandIconImageUrl).append("</Attribute>");
			if (gadgetAreaExpandIconHoverImageUrl!=null)
				sb.append("<Attribute name=\"gadget_area.expand_icon.hover_image.url\">").append(this.gadgetAreaExpandIconHoverImageUrl).append("</Attribute>");
			if (footerBackgroundColor!=null)
				sb.append("<Attribute name=\"footer.background_color\">").append(this.footerBackgroundColor).append("</Attribute>");
			if (footerTileImageUrl!=null)
				sb.append("<Attribute name=\"footer.tile_image.url\">").append(this.footerTileImageUrl).append("</Attribute>");
			if (footerCenterImageUrl!=null)
				sb.append("<Attribute name=\"footer.center_image.url\">").append(this.footerCenterImageUrl).append("</Attribute>");
			if (attributionImageUrl!=null)
				sb.append("<Attribute name=\"attribution.image.url\">").append(this.attributionImageUrl).append("</Attribute>");
			if (footerLinkColor!=null)
				sb.append("<Attribute name=\"footer.link_color\">").append(this.footerLinkColor).append("</Attribute>");
			if (footerTextColor!=null)
				sb.append("<Attribute name=\"footer.text_color\">").append(this.footerTextColor).append("</Attribute>");
		}
		sb.append("</ConfigMap>");
		return sb.toString();
	}

	public ArrayList<Trait> getTraits() {
		return traits;
	}

	public void setTraits(ArrayList<Trait> traits) {
		this.traits = traits;
	}

	public String getHeaderBackgroundColor() {
		return headerBackgroundColor;
	}

	public void setHeaderBackgroundColor(String headerBackgroundColor) {
		this.headerBackgroundColor = headerBackgroundColor;
	}

	public String getHeaderCenterImageUrl() {
		return headerCenterImageUrl;
	}

	public void setHeaderCenterImageUrl(String headerCenterImageUrl) {
		this.headerCenterImageUrl = headerCenterImageUrl;
	}

	public String getHeaderTileImageUrl() {
		return headerTileImageUrl;
	}

	public void setHeaderTileImageUrl(String headerTileImageUrl) {
		this.headerTileImageUrl = headerTileImageUrl;
	}

	public String getHeaderLogo() {
		return headerLogo;
	}

	public void setHeaderLogo(String headerLogo) {
		this.headerLogo = headerLogo;
	}

	public String getHeaderLinkColor() {
		return headerLinkColor;
	}

	public void setHeaderLinkColor(String headerLinkColor) {
		this.headerLinkColor = headerLinkColor;
	}

	public String getHeaderTextColor() {
		return headerTextColor;
	}

	public void setHeaderTextColor(String headerTextColor) {
		this.headerTextColor = headerTextColor;
	}

	public String getGadgetAreaTabBorderColor() {
		return gadgetAreaTabBorderColor;
	}

	public void setGadgetAreaTabBorderColor(String gadgetAreaTabBorderColor) {
		this.gadgetAreaTabBorderColor = gadgetAreaTabBorderColor;
	}

	public String getGadgetAreaTabSelectedBackgroundColor() {
		return gadgetAreaTabSelectedBackgroundColor;
	}

	public void setGadgetAreaTabSelectedBackgroundColor(
			String gadgetAreaTabSelectedBackgroundColor) {
		this.gadgetAreaTabSelectedBackgroundColor = gadgetAreaTabSelectedBackgroundColor;
	}

	public String getGadgetAreaTabSelectedTextColor() {
		return gadgetAreaTabSelectedTextColor;
	}

	public void setGadgetAreaTabSelectedTextColor(
			String gadgetAreaTabSelectedTextColor) {
		this.gadgetAreaTabSelectedTextColor = gadgetAreaTabSelectedTextColor;
	}

	public String getGadgetAreaTabUnselectedBackgroundColor() {
		return gadgetAreaTabUnselectedBackgroundColor;
	}

	public void setGadgetAreaTabUnselectedBackgroundColor(
			String gadgetAreaTabUnselectedBackgroundColor) {
		this.gadgetAreaTabUnselectedBackgroundColor = gadgetAreaTabUnselectedBackgroundColor;
	}

	public String getGadgetAreaTabUnselectedTextColor() {
		return gadgetAreaTabUnselectedTextColor;
	}

	public void setGadgetAreaTabUnselectedTextColor(
			String gadgetAreaTabUnselectedTextColor) {
		this.gadgetAreaTabUnselectedTextColor = gadgetAreaTabUnselectedTextColor;
	}

	public String getGadgetAreaBorderColor() {
		return gadgetAreaBorderColor;
	}

	public void setGadgetAreaBorderColor(String gadgetAreaBorderColor) {
		this.gadgetAreaBorderColor = gadgetAreaBorderColor;
	}

	public String getGadgetAreaGadgetBorderColor() {
		return gadgetAreaGadgetBorderColor;
	}

	public void setGadgetAreaGadgetBorderColor(String gadgetAreaGadgetBorderColor) {
		this.gadgetAreaGadgetBorderColor = gadgetAreaGadgetBorderColor;
	}

	public String getGadgetAreaGadgetHeaderBackgroundColor() {
		return gadgetAreaGadgetHeaderBackgroundColor;
	}

	public void setGadgetAreaGadgetHeaderBackgroundColor(
			String gadgetAreaGadgetHeaderBackgroundColor) {
		this.gadgetAreaGadgetHeaderBackgroundColor = gadgetAreaGadgetHeaderBackgroundColor;
	}

	public String getGadgetAreaGadgetHeaderTextColor() {
		return gadgetAreaGadgetHeaderTextColor;
	}

	public void setGadgetAreaGadgetHeaderTextColor(
			String gadgetAreaGadgetHeaderTextColor) {
		this.gadgetAreaGadgetHeaderTextColor = gadgetAreaGadgetHeaderTextColor;
	}

	public String getGadgetAreaGadgetBodyLinkColor() {
		return gadgetAreaGadgetBodyLinkColor;
	}

	public void setGadgetAreaGadgetBodyLinkColor(
			String gadgetAreaGadgetBodyLinkColor) {
		this.gadgetAreaGadgetBodyLinkColor = gadgetAreaGadgetBodyLinkColor;
	}

	public String getGadgetAreaMenuIconImageUrl() {
		return gadgetAreaMenuIconImageUrl;
	}

	public void setGadgetAreaMenuIconImageUrl(String gadgetAreaMenuIconImageUrl) {
		this.gadgetAreaMenuIconImageUrl = gadgetAreaMenuIconImageUrl;
	}

	public String getGadgetAreaMenuIconHoverImageUrl() {
		return gadgetAreaMenuIconHoverImageUrl;
	}

	public void setGadgetAreaMenuIconHoverImageUrl(
			String gadgetAreaMenuIconHoverImageUrl) {
		this.gadgetAreaMenuIconHoverImageUrl = gadgetAreaMenuIconHoverImageUrl;
	}

	public String getGadgetAreaDeleteIconImageUrl() {
		return gadgetAreaDeleteIconImageUrl;
	}

	public void setGadgetAreaDeleteIconImageUrl(String gadgetAreaDeleteIconImageUrl) {
		this.gadgetAreaDeleteIconImageUrl = gadgetAreaDeleteIconImageUrl;
	}

	public String getGadgetAreaDeleteIconHoverImageUrl() {
		return gadgetAreaDeleteIconHoverImageUrl;
	}

	public void setGadgetAreaDeleteIconHoverImageUrl(
			String gadgetAreaDeleteIconHoverImageUrl) {
		this.gadgetAreaDeleteIconHoverImageUrl = gadgetAreaDeleteIconHoverImageUrl;
	}

	public String getGadgetAreaCollapseIconImageUrl() {
		return gadgetAreaCollapseIconImageUrl;
	}

	public void setGadgetAreaCollapseIconImageUrl(
			String gadgetAreaCollapseIconImageUrl) {
		this.gadgetAreaCollapseIconImageUrl = gadgetAreaCollapseIconImageUrl;
	}

	public String getGadgetAreaCollapseIconHoverImageUrl() {
		return gadgetAreaCollapseIconHoverImageUrl;
	}

	public void setGadgetAreaCollapseIconHoverImageUrl(
			String gadgetAreaCollapseIconHoverImageUrl) {
		this.gadgetAreaCollapseIconHoverImageUrl = gadgetAreaCollapseIconHoverImageUrl;
	}

	public String getGadgetAreaExpandIconImageUrl() {
		return gadgetAreaExpandIconImageUrl;
	}

	public void setGadgetAreaExpandIconImageUrl(String gadgetAreaExpandIconImageUrl) {
		this.gadgetAreaExpandIconImageUrl = gadgetAreaExpandIconImageUrl;
	}

	public String getGadgetAreaExpandIconHoverImageUrl() {
		return gadgetAreaExpandIconHoverImageUrl;
	}

	public void setGadgetAreaExpandIconHoverImageUrl(
			String gadgetAreaExpandIconHoverImageUrl) {
		this.gadgetAreaExpandIconHoverImageUrl = gadgetAreaExpandIconHoverImageUrl;
	}

	public String getFooterBackgroundColor() {
		return footerBackgroundColor;
	}

	public void setFooterBackgroundColor(String footerBackgroundColor) {
		this.footerBackgroundColor = footerBackgroundColor;
	}

	public String getFooterCenterImageUrl() {
		return footerCenterImageUrl;
	}

	public void setFooterCenterImageUrl(String footerCenterImageUrl) {
		this.footerCenterImageUrl = footerCenterImageUrl;
	}

	public String getFooterTileImageUrl() {
		return footerTileImageUrl;
	}

	public void setFooterTileImageUrl(String footerTileImageUrl) {
		this.footerTileImageUrl = footerTileImageUrl;
	}

	public String getAttributionImageUrl() {
		return attributionImageUrl;
	}

	public void setAttributionImageUrl(String attributionImageUrl) {
		this.attributionImageUrl = attributionImageUrl;
	}

	public String getFooterLinkColor() {
		return footerLinkColor;
	}

	public void setFooterLinkColor(String footerLinkColor) {
		this.footerLinkColor = footerLinkColor;
	}

	public String getFooterTextColor() {
		return footerTextColor;
	}

	public void setFooterTextColor(String footerTextColor) {
		this.footerTextColor = footerTextColor;
	}
	
	
}
